﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed

#pragma once


#include "Vector3d.h"
#include "Coordinate3d.h"
#include "Vector3dUtils.h"

namespace gcmp
{
    /// \brief Coordinate3d的工具类
    ///
    /// 
    class GCMP_MATH_INTERFACE_EXPORT Coordinate3dUtils
    {
    public:

        /// \brief   判断当前坐标系与传入坐标系是否相等
        ///
        /// \param coord1  传入坐标系1
        /// \param coord2  传入坐标系2
        /// \param typeTol  容差
        /// \return  true: 相等   false:  不相等
        static bool IsEqual(const Coordinate3d& coord1, const Coordinate3d& coord2, double typeTol = gcmp::Constants::DOUBLE_EPS);

        /// \brief  计算传入坐标系的XY面和当前坐标系XY面是否平行
        ///
        /// \param coord1  传入坐标系1
        /// \param coord2  传入坐标系2
        /// \param typeTol  容差
        /// \return  true: 平行   false: 不平行
        static bool IsParallel(const Coordinate3d& coord1, const Coordinate3d& coord2, double typeTol = gcmp::Constants::DOUBLE_EPS);

        /// \brief  计算传入向量和当前坐标系XY面是否平行
        ///
        /// \param coord  传入坐标系
        /// \param dir    传入向量
        /// \param typeTol 容差
        /// \return  true: 平行   false: 不平行
        static bool IsParallel(const Coordinate3d& coord, const Vector3d& dir, double typeTol = gcmp::Constants::DOUBLE_EPS);

        /// \brief   计算传入向量和当前坐标系XY面是否垂直
        ///
        /// \param coord  传入坐标系
        /// \param dir    传入向量
        /// \param typeTol  容差
        /// \return  true: 垂直   false: 不垂直
        static bool IsPerpendicular(const Coordinate3d& coord, const Vector3d& dir, double typeTol = gcmp::Constants::DOUBLE_EPS);

        /// \brief   计算传入点距离当前坐标系XY面的最近的点
        ///
        /// \param coord    传入坐标系
        /// \param worldPt  传入点
        /// \return  最近点
        static Vector3d GetClosestPointOnXOY(const Coordinate3d& coord, const Vector3d& worldPt);

        /// \brief  计算传入点和当前坐标系XY面的距离
        ///
        /// \param worldPt  传入点
        /// \return   距离
        static double DistanceToXOY(const Coordinate3d& coord, const Vector3d& worldPt);

    };
}


